package com.bee.bootstrap.system.entity;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.bee.common.core.enums.DictionaryTypeEnum;
import com.bee.common.core.enums.StatusEnum;
import com.bee.common.core.jsonview.JsonViews;
import com.fasterxml.jackson.annotation.JsonView;
import lombok.Data;

import javax.validation.constraints.Min;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author liekkas
 * @since 2018-04-10
 */
@Data
@TableName("base_sys_dictionary")
public class Dictionary extends Model<Dictionary> {

    private static final long serialVersionUID = 1L;

	@TableId(value="id", type= IdType.ID_WORKER)
	private Long id;
    /**
     * 类型
     */
    @JsonView(JsonViews.Internal.class)
	private String type;
	/**
	 * 数据字典名称
	 */
    private String name;
    /**
     * 键
     */
    @JsonView({JsonViews.Private.class,JsonViews.Group.class})
	private String dictionaryKey;
    /**
     * 值
     */
    @JsonView(JsonViews.Private.class)
	private String dictionaryValue;
    /**
     * 排序
     */
	@Min(value = 0,message = "排序必须是整数")
	@JsonView(JsonViews.Internal.class)
	private Integer priority;
    /**
     * 父级ID
     */
	@JsonView(JsonViews.Private.class)
	@TableField("parent_id")
	private Long parentId;
	/**
	 * 完整的父主键路径
	 */
	@TableField("full_parent_ids")
	private String fullParentIds;
    /**
     * 全值
     */
	@TableField("full_value")
	private String fullValue;
    /**
     * 状态
     */
	private String status;

	/**
	 *描述
	 */
	private String description;
    /**
     * 创建时间
     */
	@TableField("create_time")
	private Date createTime;
    /**
     * 有效时间
     */
	@TableField("update_time")
	private Date updateTime;



	@Override
	protected Serializable pkVal() {
		return this.id;
	}

	private transient List<StatusEnum> statusEnums= Arrays.asList(StatusEnum.values());

	private transient List<Dictionary> childrensView;

	private transient List<DictionaryTypeEnum> dictionaryEnums =Arrays.asList(DictionaryTypeEnum.values());

}
